﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="admin_article.aspx.cs" Inherits="Web.admin_article" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
        <link href="css/CodeProject.css" rel="stylesheet" type="text/css" />
    <link href="css/Page.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="../js/jquery.js"></script>    
    <script type="text/javascript">
        $(document).ready(init);
        function init() {

        }
        
        function doDel(id) {
    	   
	        $.ajax({
		        type: "POST",
		        url: "admin_article_delete.aspx",
		        dataType: "html",
		        data: "id=" + id,
		        timeout: 30000,
		        success: function(data){
	                alert("删除成功!");
	                window.location.reload();
		        },
		        error: function(xmlHttpRequest, error) {
        								
		        }
        					
	        });
    	        
	    }
        
    </script>   
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
       <table style="border:1px solid #000000;margin-top:10px" border="0" cellpadding="0" cellspacing="0" width="98%">
         <tr>
                <td colspan="6" class="TitleBar" colspan="left" align="center">
                    文章管理
                </td>
            </tr>
            <tr>
                <td class="Pager" colspan="6" align="right">
                    <asp:Button style="margin-right:10px" ID="btAdd" runat="server" Text="添加文章" 
                        onclick="btAdd_Click" />
                </td>
            </tr>  
            
             <tr>
                <td class="Pager" colspan="6" align="left">
                    <span style="margin-left:5px">文章标题：</span><asp:TextBox onkeydown="if(event.keyCode==13){document.getElementById('btArticleSearch').click(); return false;}" style="width:250px;margin-left:10px" ID="tbArticleName" runat="server"></asp:TextBox>
                     <asp:Button ID="btArticleSearch" runat="server" Text="文章搜索" 
                        onclick="btArticleSearch_Click" />
                </td>
            </tr>      
             <tr>
                <td class="MenuItem" align="center">标题</td>
                <td class="MenuItem" align="center">类别</td>
                <td class="MenuItem" align="center">状态</td>
                <td class="MenuItem" align="center">创建时间</td>
                <td class="MenuItem" align="center">更新时间</td>
                <td class="MenuItemRight" align="center">操作</td>
            </tr> 
       
        <asp:Repeater ID="Repeater1" runat="server">
         <ItemTemplate>         
                      <tr>
                        <td class="RecordItem" align="center" style="width:300px">&nbsp;<a style="text-decoration:none" target="_blank" href="../admin_article_preview.aspx?id=<%#DataBinder.Eval(Container.DataItem,"Id")%>"><span style="color:Green"><%#DataBinder.Eval(Container.DataItem,"Title")%></span></a></td>
                        <td class="RecordItem" align="center">&nbsp;<%#DataBinder.Eval(Container.DataItem,"kindName")%></td>
                        <td class="RecordItem" align="center">&nbsp;<span id="s_<%#DataBinder.Eval(Container.DataItem,"Id")%>"><%#(DataBinder.Eval(Container.DataItem, "Status").ToString().Equals("1") ? "<span style='color:green'>有效</span>" : "<span style='color:red'>无效</span>")%></span></td>
                        <td class="RecordItem" align="center">&nbsp;<%#DataBinder.Eval(Container.DataItem, "Createdate")%></td>
                        <td class="RecordItem" align="center">&nbsp;<%#DataBinder.Eval(Container.DataItem, "Lastupdate")%></td>
                        <td class="RecordItemRight" align="center">
                            <a class="Link" target="_blank" href="../admin_article_preview.aspx?id=<%#DataBinder.Eval(Container.DataItem,"Id")%>">预览</a>
                            <a class="LinkRight" href="../admin_articlemodify.aspx?id=<%#DataBinder.Eval(Container.DataItem,"Id")%>">修改</a>
                            <a class="LinkRight" onclick="if( window.confirm('确实删除?') == false ) return false;else {doDel(<%#DataBinder.Eval(Container.DataItem,"Id")%>);}" href="#">删除</a>
                        </td>
                     </tr> 
                </ItemTemplate>
        
        </asp:Repeater>
        
        <tr>
                <td class="Pager" colspan="6" align="center">
                    <%=pageCtrl%>
                </td>
            </tr>  
        </table>
    </div>
    </form>
</body>
</html>
